package jbl.action;

import java.io.InputStream;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class DownloadFileAction extends ActionSupport {

	/**
	 * 下载服务器文件工具
	 */
	private static final long serialVersionUID = 1L;
	// 该属性石依赖注入的属性，可以在配置文件中动态指定该属性
	private String inputPath;

	public void setInputPath(String inputPath) {
		this.inputPath = inputPath;
	}

	// @Author jblcxg
	// 下载用的Action应该返回一个InputStream实例
	// 该方法对应在result里的inputName属性值为targetFile

	public InputStream getTargetFile() throws Exception {

		InputStream in = ServletActionContext.getServletContext()
				.getResourceAsStream(inputPath);
		return in;
	}

	/**
	 * 
	 * @return 档案上传excel模板
	 * @throws Exception
	 */
	public String daExcelDemo() throws Exception {
		return SUCCESS;
	}
	/**
	 * 
	 * @return 箱柜信息上传excel模板
	 * @throws Exception
	 */
	public String xgExcelDemo() throws Exception {
		return SUCCESS;
	}
}
